home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_100
/
158_01
/
qe.h
< prev
next >
Wrap
Text File
|
1987-10-10
|
10KB
|
291 lines
/* VERSION 0033 (DATE: 30/04/87) (TIME: 13:17) */
/*
e (qe) screen editor
(C) G. Nigel Gilbert, MICROLOGY, 1981
licensed for private non-profitmaking use 1983
August-December 1981
Modified: To QE from e (ver 4.6a) by J.W. Haefner -- Oct 84-Mar 85
To QEA 26.vii.85
FILE: qe.h
PURPOSE: standard header file, #included in all function files
(NB e does NOT require "bdscio.h")
*/
#define VERSION "4.6a/QE:1.21"
/* 10.iv.87
compile with -e9080 (e10 with -o as well) [qe11+ no wwrap]
load with -tA8b0 using l2
*/
/* QET */
/* compile: w/ qe11 (VERSION) + WWRAP=NO use: -e9080, -tA8B0*/
/* compile: w/ qe11 (VERSION) + WWRAP=YES use: -e9580, -tad80 (??)*/
/* compile: w/o qe11 (VERSION) + WWRAP=YES use: -e8C80, -tA500 */
/* compile: w/o qe11 (VERSION) + WWRAP=NO use: -e8580, -t9D00 */
/* QEA */
/* compile: w/ qe11 (VERSION) + WWRAP=NO use: -e8FD0, -tA880 */
#define TOP 0xA8B0 /*top of program (STACK space=TOP-Externals End)*/
#define CCP 0x0800 /*length of CP/M's CCP */
#define SECSIZ 128 /*file buffer definitions*/
#define NSECTS 16
#define IOBUFSIZ (NSECTS * SECSIZ + 6 )
#define FILELEN 16 /*max length of file name*/
#define JBUFSIZE 6 /*size of buffer required for longjumps*/
#define LLIM 255 /*max length of a line*/
#define FLIM 80 /*max length of find/alter string*/
#define FAIL -1
#define NULL 0
#define YES 1
#define NO 0
#define PREV -2
/* --- major editor options flags --- */
#define WWRAP (NO) /*allow word wrap and reformatting?*/
#define SCRNDIMMD (NO) /*yes==>highlite current line,no==>all brite */
#define PRINTALL (YES) /*yes==>send all chars to printer*/
#define VRSNNUM (YES) /*put version number at file top on save*/
#define VRSNDATE (YES) /*put version date/time w/ version num */
#define NOWLOC 0x50 /*CP/M page 0 loc for date and time*/
#define NOCLOCK (YES) /*clock for version*/
#define VRSNLEN 56 /*length of verson string*/
#define SWIDTH 79 /*screen size*/
#define SHEIGHT 23
#define OFFWIDTH 20 /*horizontal scroll increment*/
#define PAGEOVERLAP 4 /*overlap between pages with UP,DOWN-PAGE*/
#define HELPLINES 8 /*top line number when help menu is on display */
#define FNPOS 8 /*status line - position of file name*/
#define LNPOS 23 /* position of line number*/
#define EMPOS 32 /* position of error message*/
#define WAITPOS 32 /* position of cursor when searching/reading*/
#define REPPOS 50 /* position of "Replace?" message*/
#define BACKSP 0x08 /*backspace*/
#define ENDFILE 0x1a /*CP/M end of text file mark */
#define CTRL 0x1f /*last control char.*/
#define PARBIT 0x80 /*parity bit used as a flag by testkey() */
#define NKEYS 32 /*number of key codes*/
#define GOTOLEN 6 /*approx no. keys in control code <e4.8>*/
/*internal key codes ('e' ver 4.6a key assignments in parentheses)*/
#define LEADIN 0 /*lead in chararacter to key codes -
ignored, but following key code parity set*/
#define DOWNKEY 1 /*cursor down (X)*/
#define UPKEY 2 /*cursor up (E)*/
#define LEFTKEY 3 /*cursor left (S)*/
#define RIGHTKEY 4 /*cursor right (D)*/
#define RIGHTWKEY 5 /*cursor right one word (F) */
#define LEFTWKEY 6 /*cursor left one word (A) */
#define EOLKEY 7 /*cursor to end of line (P) */
#define BOLKEY 8 /*cursor to beginning of line (O) */
#define UPPAGE 9 /*move up a page (R) */
#define DOWNPAGE 10 /*move down a page (C) */
#define BOFKEY 11 /*cursor to beginning of file (U) */
#define HOMEKEY 12 /*cursor to end of file (B) */
#define DELLEFT 13 /*delete char to left of cursor (DEL) */
#define DELRIGHT 14 /*delete char under cursor (G) */
#define DELLNKEY 15 /*delete cursor line (\) */
#define DELWDKEY 16 /*delete word to right of cursor (T) */
#define JUMPKEY 17 /*jump to (J) */
#define CRSTILL 18 /*insert newline after cursor (N) */
#define QWIKKEY 19 /*quick actions (find etc) (Q) */
#define SCRLDNKEY 20 /*scroll down (Z)*/
#define TOPSCRKEY 21 /*top of screen (Y) */
#define BOTSCRKEY 22 /*bottom of screen (V) */
#define BLOCKKEY 23 /*block operations (K) */
#define SCRLUPKEY 24 /*scrolll up (W) */
#define REPKEY 25 /*repeat last find/alter (L) */
/*#define HELPKEY 26*/ /*display help menu (V) */
#define UNDELINE 26 /*inject a previously deleted line*/
#define OOPSKEY 27 /*restore unedited line (_) */
#define TAB 28 /*tab (I)*/
#define RETRIEVE 29 /*retrieve last name etc entered here (L)*/
#define CR 30 /*return (M)*/
#define ESCKEY 31 /*the magic escape key (ESC)*/
/* key codes + 0x80 (PARBIT) used in scanning strings */
#define LEFTKEY_P 131
#define DELLEFT_P 141
#define RETRIEVE_P 157
#define CR_P 158
#define ESCKEY_P 159
#define BRIDIM '|' /*char placed in e's message strings to start/stop
dim (half-intensity) display */
/* CP/M bdos function codes */
#define RESET 0
#define CONIN 0x01
#define CONOUT 0x02
#define LSTOUT 0x05
#define DIRIO 0x06
#define IOBYTE 0x07
#define SETIOBYTE 0x08
#define PRINTS 0x09
#define READBUF 0x0A
#define CONSTAT 0x0B
#define VERNO 0x0C
#define RESETDSK 0x0D
#define SELDSK 0x0E
#define OPEN 0x0F
#define CLOSEF 0x10
#define SEARCH1 0x11
#define SEARCHN 0x12
#define DELETEF 0x13
#define READ 0x14
#define WRITE 0x15
#define MAKE 0x16
#define RENAME 0x17
#define LOGINV 0x18
#define CURDSK 0x19
#define SETDMA 0x1A
#define PROTECT 0x1C
#define GETROV 0x1d
#define DSKPARAMS 0x1F
#define READR 0x21
#define WRITER 0x22
#define FSIZE 0x23
#define SETRR 0x24
#define RESETDRV 0x25
#define MAXSLOTS 128 /*virtual memory constants*/
#define MAXMEMSLOTS 20 /*for 64k TPA (CP/M816); old=20*/
#define PAGESIZE 1024
#define PAGESECTS (PAGESIZE/SECSIZ)
#define FREE 0
#define INUSE 1
#define NOTAVAIL -1
#define MAXINT 32767
#define NOFILE (MAXINT)
#define ABSOLUTE 0
#define UNKNOWN (MAXINT)
#define sint char
struct addr {
sint page;
int moffset;
} *tp; /*address of text of each line*/
int allocp; /*location of next free in newpage */
int pageloc[MAXSLOTS]; /*current location of each page*/
int usage[MAXMEMSLOTS]; /*records usage of in memory slots*/
char *slotaddr[MAXMEMSLOTS]; /*memory addr of start of each in memory slot*/
sint dskslots[MAXSLOTS]; /*is disk slot free*/
sint slotsinmem; /*max no. of slots available in memory*/
sint tppages; /*no. of pages used to hold text pointers*/
sint newpage; /*page no of page being filled with text*/
char *npaddr; /*base of slot holding newpage*/
int clock; /*counter for least recently used paging*/
int pagefd; /*file descriptor of paging file*/
char pagingfile[FILELEN]; /*name of paging file*/
char pagingdisk; /*disk to put paging file on*/
sint curdsk; /*currently logged in (default) disk*/
char mainmenu[JBUFSIZE]; /*for emergency longjump*/
int goodline; /*line number we know we can display */
unsigned errold[4]; /*temp store for CP/M's error jump addrs*/
char dskerr[JBUFSIZE]; /*for bdos disk error traps*/
char textbuf[IOBUFSIZ]; /*io buffer for file being edited*/
sint cursorx, cursory; /*current position of cursor*/
char tran[NKEYS]; /*translation table from external to internal
key codes*/
sint isdim; /*last char was in dim*/
int lastl; /*number of last line of text*/
int lastread; /*last line actually read to date*/
sint goteof; /*true when eof of file being edited*/
sint changed; /*true if file has been modified*/
int cline; /*current line*/
char text[LLIM]; /*buffer for current line of text*/
char textb[LLIM]; /*buffer for last deleted line*/
int charn; /*position of current char in current line*/
sint altered; /*if YES, current line has been altered by edits*/
int pfirst, plast; /*top and bottom line displayed on screen*/
sint topline; /*first line on screen for text*/
sint offset; /*first col. to display on screen*/
sint lastoff; /*offset last time resetcursor() was called*/
sint blankedmess; /*message area has been blanked, not overwritten*/
c